package com.example.monitordemo.constant;


import static com.example.monitordemo.config.MonitorConfig.WINDOWS_INSTANCE;
import static com.example.monitordemo.config.MonitorConfig.WINDOWS_JOB_NAME;

public interface WinConstant {

    /**
     * windows机器概况
     */
    String WINDOWS_OVERVIEW = "windows_os_info{job=~\""+WINDOWS_JOB_NAME+"\"} * on(instance) group_right(product) windows_cs_hostname";
    /**
     * 各主机cpu使用率
     */
    String CPU_USE_RATE = "(avg by (instance) (irate(windows_cpu_time_total{job=~\""+WINDOWS_JOB_NAME+"\",mode=~\"dpc|interrupt|privileged|user\"}[2m])) * 100)";

    /**
     * 各主机内存使用率
     */
    String MEMORY_USE_RATE = "100.0 - 100 * windows_os_physical_memory_free_bytes{job=~\""+WINDOWS_JOB_NAME+"\", product!=\"Microsoft Windows 10 Home China\"} / windows_cs_physical_memory_bytes{job=~\""+WINDOWS_JOB_NAME+"\", product!=\"Microsoft Windows 10 Home China\"}";

    /**
     * 各主机最大流量网卡网络详情-发送
     */
    String NET_MAX_SENT_DETAIL = "max by (instance) (irate(windows_net_bytes_sent_total{job=~\""+WINDOWS_JOB_NAME+"\", nic!~\"'isatap.*|VPN.*'\", product!=\"Microsoft Windows 10 Home China\"}[2m]))*8";

    /**
     * 各主机最大流量网卡网络详情-接收
     */
    String NET_MAX_RECEIVED_DETAIL= "max by (instance) (irate(windows_net_bytes_received_total{job=~\""+WINDOWS_JOB_NAME+"\", nic!~\"'isatap.*|VPN.*'\", product!=\"Microsoft Windows 10 Home China\"}[2m]))*8";

    /**
     * 各主机最大读详情
     */
    String DISK_MAX_READ_DETAIL = "max by (instance) (irate(windows_logical_disk_read_bytes_total{product!=\"Microsoft Windows 10 Home China\"}[2m]))";

    /**
     * 各主机最大写详情
     */
    String DISK_MAX_WRITE_DETAIL = "max by (instance) (irate(windows_logical_disk_write_bytes_total{product!=\"Microsoft Windows 10 Home China\"}[2m]))";

    /**
     * 各主机最大磁盘输入（IO）详情
     */
    String DISK_MAX_INPUT_DETAIL= "max by (instance) (irate(windows_logical_disk_reads_total{product!=\"Microsoft Windows 10 Home China\"}[2m]))";

    /**
     * 各主机最大磁盘输出（IO）详情
     */
    String DISK_MAX_OUTPUT_DETAIL="max by (instance) (irate(windows_logical_disk_writes_total{product!=\"Microsoft Windows 10 Home China\"}[2m]))";

    /**
     * 每次磁盘读耗时-毫秒单位
     */
    String DISK_READ_TIME = "windows_logical_disk_read_seconds_total{product!=\"Microsoft Windows 10 Home China\"}/windows_logical_disk_reads_total{product!=\"Microsoft Windows 10 Home China\"} * 1000";

    /**
     * 每次磁盘写耗时-毫秒单位
     */
    String DISK_WRITE_TIME = "windows_logical_disk_write_seconds_total{product!=\"Microsoft Windows 10 Home China\"}/windows_logical_disk_writes_total{product!=\"Microsoft Windows 10 Home China\"} * 1000";


    /**
     * CPU使用率
     */
    String SINGLE_CPU_USE_RATE = "(avg by (instance) (irate(windows_cpu_time_total{job=~\""+WINDOWS_JOB_NAME+"\", instance=~\""+ WINDOWS_INSTANCE +"\", mode=~\"dpc|interrupt|privileged|user\", product!=\"Microsoft Windows 10 Home China\"}[2m])))*100";

    /**
     * 内存使用率
     */
    String SINGLE_MEMORY_USE_RATE="100 - (windows_os_physical_memory_free_bytes{job=~\""+WINDOWS_JOB_NAME+"\", instance=~\""+ WINDOWS_INSTANCE +"\", product!=\"Microsoft Windows 10 Home China\"} / windows_cs_physical_memory_bytes{job=~\""+WINDOWS_JOB_NAME+"\", instance=~\""+ WINDOWS_INSTANCE +"\", product!=\"Microsoft Windows 10 Home China\"})*100";

    /**
     * CPU核数
     */
    String SINGLE_CPU_NUM=" windows_cs_logical_processors{job=~\""+WINDOWS_JOB_NAME+"\", instance=~\""+ WINDOWS_INSTANCE +"\", product!=\"Microsoft Windows 10 Home China\"}";

    /**
     * CPU频率
     */
    String CPU_RATE = "avg by (instance) (windows_cpu_core_frequency_mhz{job=~\""+WINDOWS_JOB_NAME+"\"})";

    /**
     * C盘使用率
     */
    String C_DISK_USE_RATE = "1 - (windows_logical_disk_free_bytes{job=~\""+WINDOWS_JOB_NAME+"\",volume=~\"C:\"}/windows_logical_disk_size_bytes{job=~\""+WINDOWS_JOB_NAME+"\",volume=~\"C:\"})";

    /**
     * 使用最多分区
     */
    String MAX_USE_DISK = "max by (instance) (1-windows_logical_disk_free_bytes{job=~\""+WINDOWS_JOB_NAME+"\"}/windows_logical_disk_size_bytes{job=~\""+WINDOWS_JOB_NAME+"\"})";

    /**
     * 运行服务数
     */
    String RUNNING_SERVICES = "sum by (instance) (windows_service_state{job=~\""+WINDOWS_JOB_NAME+"\",state=~\"running\"})";

    /**
     * 总内存
     */
    String SINGLE_MEMORY_TOTAL="windows_cs_physical_memory_bytes{job=~\""+WINDOWS_JOB_NAME+"\", instance=~\""+ WINDOWS_INSTANCE +"\", product!=\"Microsoft Windows 10 Home China\"}";

    /**
     * 启动时长
     */
    String SINGLE_START_UP_TIME="time() - windows_system_system_up_time{job=~\""+WINDOWS_JOB_NAME+"\", instance=~\""+ WINDOWS_INSTANCE +"\", product!=\"Microsoft Windows 10 Home China\"}";

    /**
     *  各分区使用率
     */
    String EACH_DISK_USE_RATE="100 - (windows_logical_disk_free_bytes{job=~\""+WINDOWS_JOB_NAME+"\", instance=~\""+ WINDOWS_INSTANCE +"\", product!=\"Microsoft Windows 10 Home China\"} / windows_logical_disk_size_bytes{job=~\""+WINDOWS_JOB_NAME+"\", instance=~\""+ WINDOWS_INSTANCE +"\", product!=\"Microsoft Windows 10 Home China\"})*100";


    /**
     * 服务状态
     */
    String SERVICE_STATUS="sum(windows_service_state{job=~\""+WINDOWS_JOB_NAME+"\", instance=~\""+ WINDOWS_INSTANCE +"\", product!=\"Microsoft Windows 10 Home China\"}) by (state)";

    /**
     * 进程数
     */
    String PROCESS_NUM="windows_os_processes{job=~\""+WINDOWS_JOB_NAME+"\", instance=~\""+ WINDOWS_INSTANCE +"\", product!=\"Microsoft Windows 10 Home China\"}";

    /**
     * cpu使用率
     */
    String SINGLE_CPU_USE_RATE2="avg(irate(windows_cpu_time_total{job=~\""+WINDOWS_JOB_NAME+"\", instance=~\""+ WINDOWS_INSTANCE +"\", mode=~\"dpc|interrupt|privileged|user\", product!=\"Microsoft Windows 10 Home China\"}[5m]))*100";

    /**
     * 总物理内存
     */
    String SINGLE_PHYSICAL_MEMORY="windows_cs_physical_memory_bytes{job=~\""+WINDOWS_JOB_NAME+"\", instance=~\""+ WINDOWS_INSTANCE +"\", product!=\"Microsoft Windows 10 Home China\"}";

    /**
     * 剩余物理内存
     */
    String SINGLE_PHYSICAL_MEMORY_FREE="windows_os_physical_memory_free_bytes{job=~\""+WINDOWS_JOB_NAME+"\", instance=~\""+ WINDOWS_INSTANCE +"\", product!=\"Microsoft Windows 10 Home China\"}";

    /**
     * 总虚拟内存
     */
    String SINGLE_VIRTUAL_MEMORY="windows_os_virtual_memory_bytes{job=~\""+WINDOWS_JOB_NAME+"\", instance=~\""+ WINDOWS_INSTANCE +"\", product!=\"Microsoft Windows 10 Home China\"}";

    /**
     * 剩余虚拟内存
     */
    String SINGLE_VIRTUAL_MEMORY_FREE="windows_os_virtual_memory_free_bytes{job=~\""+WINDOWS_JOB_NAME+"\", instance=~\""+ WINDOWS_INSTANCE +"\", product!=\"Microsoft Windows 10 Home China\"}";

    /**
     *  磁盘总空间
     */
    String SINGLE_DISK_BYTES="windows_logical_disk_free_bytes{job=~\""+WINDOWS_JOB_NAME+"\", instance=~\""+ WINDOWS_INSTANCE +"\", product!=\"Microsoft Windows 10 Home China\"}";

    /**
     * 剩余磁盘空间
     */
    String SINGLE_DISK_BYTES_FREE="windows_logical_disk_size_bytes{job=~\""+WINDOWS_JOB_NAME+"\", instance=~\""+ WINDOWS_INSTANCE +"\", product!=\"Microsoft Windows 10 Home China\"}";

    /**
     * 网络上传
     */
    String SINGLE_NET_SENT="irate(windows_net_bytes_sent_total{job=~\""+WINDOWS_JOB_NAME+"\", instance=~\""+ WINDOWS_INSTANCE +"\", nic!~\"'isatap.*|VPN.*'\", product!=\"Microsoft Windows 10 Home China\"}[5m])*8>0";

    /**
     * 网络下载
     */
    String SINGLE_NET_RECEIVED="irate(windows_net_bytes_received_total{job=~\""+WINDOWS_JOB_NAME+"\", instance=~\""+ WINDOWS_INSTANCE +"\", nic!~\"'isatap.*|VPN.*'\", product!=\"Microsoft Windows 10 Home China\"}[5m])*8";

    /**
     * 磁盘读
     */
    String SINGLE_DISK_READ="irate(windows_logical_disk_read_bytes_total{job=~\""+WINDOWS_JOB_NAME+"\", instance=~\""+ WINDOWS_INSTANCE +"\", product!=\"Microsoft Windows 10 Home China\"}[5m])";

    /**
     * 磁盘写
     */
    String SINGLE_DISK_WRITE="irate(windows_logical_disk_write_bytes_total{job=~\""+WINDOWS_JOB_NAME+"\", instance=~\""+ WINDOWS_INSTANCE +"\", product!=\"Microsoft Windows 10 Home China\"}[5m])";

    /**
     * 磁盘INPUT
     */
    String SINGLE_DISK_INPUT="irate(windows_logical_disk_reads_total{job=~\""+WINDOWS_JOB_NAME+"\", instance=~\""+ WINDOWS_INSTANCE +"\", product!=\"Microsoft Windows 10 Home China\"}[5m])";

    /**
     * 磁盘OUTPUT
     */
    String SINGLE_DISK_OUTPUT="irate(windows_logical_disk_writes_total{job=~\""+WINDOWS_JOB_NAME+"\", instance=~\""+ WINDOWS_INSTANCE +"\", product!=\"Microsoft Windows 10 Home China\"}[5m])";

    /**
     * 网络使用率
     */
    String SINGLE_NET_USE_RATE="(irate(windows_net_bytes_total{job=~\""+WINDOWS_JOB_NAME+"\",instance=~\""+ WINDOWS_INSTANCE +"\",nic!~'isatap.*|VPN.*'}[5m]) * 8 / windows_net_current_bandwidth{job=~\""+WINDOWS_JOB_NAME+"\",instance=~\""+ WINDOWS_INSTANCE +"\",nic!~'isatap.*|VPN.*'}) * 100";


    /**
     * 网络发送丢包率
     */
    String SINGLE_NET_SENT_ERROR_RATE="irate(windows_net_packets_outbound_discarded{job=~\""+WINDOWS_JOB_NAME+"\",instance=~\""+ WINDOWS_INSTANCE +"\", nic!~'isatap.*|VPN.*'}[5m]) %2B irate(windows_net_packets_outbound_errors{job=~\""+WINDOWS_JOB_NAME+"\",instance=~\""+ WINDOWS_INSTANCE +"\"}[5m])";

    /**
     * 网络接受丢包率
     */
    String SINGLE_NET_RECEIVED_ERROR_RATE="irate(windows_net_packets_received_discarded{job=~\""+WINDOWS_JOB_NAME+"\",instance=~\""+ WINDOWS_INSTANCE +"\", nic!~'isatap.*|VPN.*'}[5m]) %2B irate(windows_net_packets_received_errors{job=~\""+WINDOWS_JOB_NAME+"\",instance=~\""+ WINDOWS_INSTANCE +"\"}[5m])";

    /**
     * 系统线程数
     */
    String SINGLE_THREAD_NUM="windows_system_threads{job=~\""+WINDOWS_JOB_NAME+"\", instance=~\""+ WINDOWS_INSTANCE +"\", product!=\"Microsoft Windows 10 Home China\"}";

    /**
     * 系统异常调度
     */
    String  SINGLE_SYSTEM_EXCEPTION_DISPATCHES="irate(windows_system_exception_dispatches_total{job=~\""+WINDOWS_JOB_NAME+"\", instance=~\""+ WINDOWS_INSTANCE +"\", product!=\"Microsoft Windows 10 Home China\"}[5m])";

}
